// JavaScript Document
district = jQuery.noConflict();
 district().ready(function() {
						   
					
                    district("#profile-district-node-form").validate({
													  


// Title Validation
  rules: {
	  		'field_dis_name[und]':{
			required:true,
			valuenotequals: '_none',
			},
			'field_dis_area[und][0][value]':{
			required:true,
			minlength: 5,
			maxlength: 255,
			badchar:true,
			},
			'field_dis_population[und][0][value]':{
			required:true,
			minlength: 5,
			maxlength: 255,
			badchar:true,
			},
			'title':{
			required:true,
			minlength: 5,
			maxlength: 255,
			badchar:true,
			},
			'field_dis_languages[und][0][value]':{
			required:true,
			minlength: 5,
			maxlength: 255,
			badchar:true,
			},
			'field_dist_url[und][0][value]':{
			url:true,
			},
  },
  messages:{
  			'field_dis_name[und]':{
			required:'Please Select District Name',
			valuenotequals: 'Please Select District Name',
			},
			'field_dis_area[und][0][value]':{
			required:'Please Enter the area of the district',
			minlength: 'Minimum 5 characters should be entered',
			maxlength: 'Maximum 255 character only allowed',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
			},
			'field_dis_population[und][0][value]':{
			required:' Please Enter the Population of the district',
			minlength: 'Minimum 5 characters should be entered',
			maxlength: 'Maximum 255 character only allowed',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
			},
			'title':{
			required:' Please Enter the District Headquarters',
			minlength: 'Minimum 5 characters should be entered',
			maxlength: 'Maximum 255 character only allowed',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
			},
			'field_dis_languages[und][0][value]':{
			required:  'Please Enter the languages',
			minlength: 'Minimum 4 characters should be entered',
			maxlength: 'Maximum 255 character only allowed',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
			},
			'field_dist_url[und][0][value]':{
			url:'Invalid URL',
			},

  },
  invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //district("#documents-node-form").create_errormsg_container('errormsg_container','documents-node-form');
						}
							
							district('html, body').animate({
								scrollTop: district(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});




            
});

			
			